package plugins.yzhkof.view
{
    import flash.display.*;
    import flash.text.*;

    public class TextContainer extends Sprite
    {
        protected var panel:Sprite;
        protected var offset:Number = 5;

        public function TextContainer()
        {
            addChild(panel);
            panel.y = -30;
            panel.mouseEnabled = false;
            contentText.selectable = false;
            contentText.mouseEnabled = false;
            return;
        }// end function

        public function set text(_embeddedFontRegistry:String) : void
        {
            contentText.text = _embeddedFontRegistry;
            contentText.autoSize = TextFieldAutoSize.CENTER;
            contentText.x = left.x + left.width;
            center.width = contentText.width;
            right.x = left.x + left.width + center.width;
            return;
        }// end function

        private function get contentText() : TextField
        {
            return panel.getChildByName("text") as TextField;
        }// end function

        private function get back() : Sprite
        {
            return panel.getChildByName("back") as Sprite;
        }// end function

        private function get left() : Sprite
        {
            return panel.getChildByName("left") as Sprite;
        }// end function

        protected function set PanelClass(_embeddedFontRegistry:Sprite) : void
        {
            panel = _embeddedFontRegistry;
            return;
        }// end function

        public function get text() : String
        {
            return contentText.text;
        }// end function

        private function get center() : Sprite
        {
            return panel.getChildByName("center") as Sprite;
        }// end function

        private function get right() : Sprite
        {
            return panel.getChildByName("right") as Sprite;
        }// end function

    }
}
